Submitted By: Ken Moffat <ken at linuxfromscratch dot org>
Date: 2012-05-01
Initial Package Version: 1.15.3
Upstream Status: Applied
Origin: Upstream, commit:83f0743c1fed872d80a0dd31924575d9bf9c2770
Description:

loadkeys from 1.15.3 introduced a regression where it doesn’t default to
reading from stdin when started without a filename argument.

---
 src/loadkeys.y |   33 +++++++++++++++++++++------------
 1 files changed, 21 insertions(+), 12 deletions(-)

Index: devel/src/loadkeys.y
===================================================================
--- devel.orig/src/loadkeys.y	2011-07-22 19:06:52.000000000 +0200
+++ devel/src/loadkeys.y	2011-07-22 19:07:10.000000000 +0200
@@ -1035,6 +1035,22 @@
 		;
 %%
 
+static void parse_keymap(FILE *fd) {
+	if (!quiet && !optm)
+		fprintf(stdout, _("Loading %s\n"), pathname);
+
+	stack_push(fd, 0, pathname);
+
+	if (yyparse()) {
+		fprintf(stderr, _("syntax error in map file\n"));
+
+		if (!optm)
+			fprintf(stderr,
+				_("key bindings not changed\n"));
+		exit(EXIT_FAILURE);
+	}
+}
+
 int main(int argc, char *argv[])
 {
 	const char *short_opts = "abcC:dhmsuqvV";
@@ -1180,19 +1196,12 @@
 		}
 
  gotf:
-		if (!quiet && !optm)
-			fprintf(stdout, _("Loading %s\n"), pathname);
-
-		stack_push(f, 0, pathname);
-
-		if (yyparse()) {
-			fprintf(stderr, _("syntax error in map file\n"));
+		parse_keymap(f);
+	}
 
-			if (!optm)
-				fprintf(stderr,
-					_("key bindings not changed\n"));
-			exit(EXIT_FAILURE);
-		}
+	if (optind == argc) {
+		strcpy(pathname, "<stdin>");
+		parse_keymap(stdin);
 	}
 
 	do_constant();
